﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:local="clr-namespace:UTable.Objects.Controls">

    <Style TargetType="{x:Type local:UPalette}">
        <Setter Property="Background" Value="WhiteSmoke"/>
        <Setter Property="Width" Value="252"/>
        <Setter Property="Height" Value="72"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:UPalette}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            CornerRadius="4"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            Focusable="False">
                        <Border BorderBrush="Silver" BorderThickness="1" CornerRadius="4">
                            <Border BorderBrush="Silver" BorderThickness="3" CornerRadius="4">
                                <Border BorderBrush="White" BorderThickness="2" CornerRadius="4">
                                    <StackPanel Orientation="Vertical">
                                        <StackPanel Orientation="Horizontal">
                                            <local:PCube x:Name="c_White" Background="White" Width="30" Height="30" IsChosen="True"/>
                                            <local:PCube x:Name="c_Gray" Background="Gray" Width="30" Height="30"/>
                                            <local:PCube x:Name="c_Green" Background="Green" Width="30" Height="30"/>
                                            <local:PCube x:Name="c_Yellow" Background="Yellow" Width="30" Height="30"/>
                                            <local:PCube x:Name="c_Pink" Background="Pink" Width="30" Height="30"/>
                                            <local:PCube x:Name="c_Purple" Background="Purple" Width="30" Height="30"/>
                                            <local:PCube x:Name="s_2" Background="Cornsilk" Width="30" Height="30" FontFamily="Elephant" FontSize="16" IsChosen="True">2</local:PCube>
                                            <local:PCube x:Name="s_6" Background="Cornsilk" Width="30" Height="30" FontFamily="Elephant" FontSize="16">6</local:PCube>
                                        </StackPanel>
                                        <StackPanel Orientation="Horizontal">
                                            <local:PCube x:Name="c_Black" Background="Black" Width="30" Height="30"/>
                                            <local:PCube x:Name="c_Red" Background="Red" Width="30" Height="30"/>
                                            <local:PCube x:Name="c_Blue" Background="Blue" Width="30" Height="30"/>
                                            <local:PCube x:Name="c_Gold" Background="Gold" Width="30" Height="30"/>
                                            <local:PCube x:Name="c_SkyBlue" Background="SkyBlue" Width="30" Height="30"/>
                                            <local:PCube x:Name="c_Violet" Background="Violet" Width="30" Height="30"/>
                                            <local:PCube x:Name="s_4" Background="Cornsilk" Width="30" Height="30" FontFamily="Elephant" FontSize="16">4</local:PCube>
                                            <local:PCube x:Name="s_8" Background="Cornsilk" Width="30" Height="30" FontFamily="Elephant" FontSize="16">8</local:PCube>
                                        </StackPanel>
                                    </StackPanel>
                                </Border>
                            </Border>
                        </Border>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:PCube}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:PCube}">
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}" 
                            CornerRadius="2"
                            x:Name="border">
                        <ContentPresenter  Content="{TemplateBinding Content}" HorizontalAlignment="Center" VerticalAlignment="Center" TextBlock.Foreground="{TemplateBinding Foreground}"/>
                    </Border>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsChosen" Value="True">
                            <Setter Property="BorderBrush" TargetName="border" Value="RosyBrown"/>
                            <Setter Property="BorderThickness" TargetName="border" Value="3"/>
                        </Trigger>
                        <Trigger Property="IsPressed" Value="True">
                            <Setter Property="Background" TargetName="border" Value="DarkGray"/>
                        </Trigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
</ResourceDictionary>
